<include file="Public:head" title="模板分类"/>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <include file="Public:left" />
        <div class="main-content">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i><a href="__APP__/{$Think.MODULE_NAME}">首页</a></li>
                    <li><a href="{:U('Modals/cat')}">模板类别管理</a></li>
                    <li class="active">模板分类</li>
                </ul>
            </div>
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="row">
                            <div class="col-xs-12">

                                <notempty name='lists'>
                                    <div class="table-responsive">
                                        <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                                            <thead>
                                                <tr>
                                                    <th width='45px' class="center">序号</th>
                                                    <th>名称</th>
                                                    <th width="45px">标签</th>
                                                    <th width="120px">编码</th>
                                                    <th width="45px">下级</th>
                                                    <th width="80px">是否开启</th>
                                                    <th width="50px">排序</th>
                                                      <th>标题</th>
                                                         <th>关键字</th>
                                                          <th>描述</th>
                                                    <th width="45px">操作</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                            <foreach name="lists" item="row">
                                                <tr>
<!--                                                    <td class="center">
                                                        <label><input type="checkbox" class="ace" name="ids" value="{$row.id}" autocomplete="off" /><span class="lbl"></span></label>
                                                    </td>-->
                                                    <td class="center">{$key+1|getPageKey}</td>
                                                    <td><a href="{:U('Modals/cat',array('pid'=>$row['id']))}">{$row.name}</a></td>
                                                    <td><a data-toggle="modal" id="tag_{$row.id}"  onclick="choseTags($(this), '{$row.id}')" data-tags="{$row.tags}">{$row.tags_num}</a></td>
                                                    <td>{$row.code}</td>
                                                    <td>{$row.num}</td>
                                                    <td id="is_check_{$row.id}"><a onclick="yes('{$row.id}', 'modals_dictionary', 'is_check')"><if condition="$row.is_check eq 1">是<else/><span style="color:red">否</span></if></a></td>
                                                     <td><a onclick="changeOrd($(this), 'modals_dictionary', '{$row.id}')">{$row.ord}</a></td>
                                                       <td>{$row.seo_title}</td>
                                                                        <td>{$row.keywords}</td>
                                                                                  <td>{$row.description}</td>
                                                    <td class="action-buttons">
                                                        <a class="green" href="{:U('Modals/cat_detail',array('id'=>$row['id']))}" data-rel="tooltip" data-original-title="编辑"><i class="icon-pencil bigger-130"></i></a>
<!--                                                        <a class="red" data-toggle="modal"  onclick="targetDelTable('{$row.id}')"data-rel="tooltip" data-original-title="删除"><i class="icon-trash bigger-130"></i></a>-->
                                                    </td>
                                                </tr>
                                            </foreach>
                                            </tbody>
                                        </table>

                                    </div>
                                    <div id="grid-pager" class="ui-state-default  ui-corner-bottom" dir="ltr">
                                        <table width='100%' data-table='modals_dictionary'  id='modal_del_table'>
                                            <tr>
                                                <td>
                                                    <div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
                                                        <a class="purple" href="{:U('Modals/cat_detail',array('pid'=>$pid))}" data-rel="tooltip" data-original-title="添加模板分类">
                                                            <i class="icon-plus-sign bigger-130"></i>
                                                        </a>
                                                        <a class="red" data-toggle="modal" onclick="targetDelTable(0)"  data-rel="tooltip" data-original-title="批量删除">
                                                            <i class="icon-trash bigger-130"></i>
                                                        </a>
                                                    </div>
                                                </td>
                                                <td class='td_pager'><div class='pager'>{$page}</div></td>
                                            </tr>
                                        </table>
                                    </div>
                                    <else/>
                                    <p class='noempty'>没有符合条件的记录,立即<a href="{:U('Modals/cat_detail',array('pid'=>$pid))}">添加</a></p>
                                </notempty>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <include file="Public:setting" />
    </div>
</div>

<include file="Public:del" />
<include file="Public:foot" />
<script>
    function choseTags(obj, id) {
        $("#modal_tags").modal('toggle');
        $("#modal_tags").attr('data-id', id);
        var tags = obj.attr("data-tags");
        $("#modal_tags").attr('data-tags', tags + ",");
        getTagsLists(id, tags);
    }
    function getTagsLists(id, tags) {
//        if(tags != ''){
//            tags = tags.split(",",tags);
//           var tagsArr = uniQueue(clearEmptyArr(tags));
//          tags = tagsArr.join(',');
//        }
        $.get("{:U('Box/tags_lists')}", {
            tags: tags,
            id: id
        }, function(data) {
            $('#ajax_lists').html(data);
        })
    }
</script>
<div class="modal fade" id="modal_tags" data-id="0" data-modal="charge" data-table="hire_needs" data-modal="" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">标签选择</h4>
            </div>
            <div class="modal-body"id="ajax_lists"></div>
            <div class="modal-footer">
                <button class="btn btn-danger btn-xs ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false" onclick="choseTagsBoxConfirm()">
                    <span class="ui-button-text">
                        <i class="icon-ok bigger-110"></i>
                        确 定
                    </span>
                </button>
                <button class="btn btn-xs ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false" data-dismiss="modal">
                    <span class="ui-button-text">
                        <i class="icon-remove bigger-110"></i>
                        取 消
                    </span>
                </button>
            </div>
        </div>
    </div>
</div>